<template>
    <div><strong>案例：点击每个元素， alert 出对应的数据</strong></div>
    <hr>

    <p @click="AlertHander(item)" v-for="(item, index) of quote">{{ item }}</p>

    <div><strong>在传递参数的同时还能传递事件对象，只需在传递的参数后面加上上 $event</strong></div>
    <hr>

    <p @click="AlertHanderEvent(item, $event)" v-for="(item, index) of quote">{{ item }}</p>

</template>

<script>
export default {
    data() {
        return {
            quote: ["路漫漫其修远兮，吾将上下而求索。", "看惯了长夜，仍然要向往天明。", "有些景色必须前进才能看到，那么只有勇往直前。"]
        }
    },
    methods: {
        AlertHander(msg) {
            alert(msg);
        },
        AlertHanderEvent(msg, e) {
            console.log(msg);
            console.log(e);
        }
    }
}
</script>